package com.nbsaas.boot.ai.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;
import java.util.Date;

/**
 * AI模型实体类
 * 
 * @author 系统生成
 */
@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "AI模型", model = "AI模型")
@Entity
@Table(name = "bs_ai_model")
@Comment("AI模型表")
public class AiModel extends AbstractEntity {

    @Comment("模型名称")
    @SearchItem(name = "modelName", key = "modelName", label = "模型名称")
    @FormField(title = "模型名称", sortNum = "1", grid = true, required = true)
    @Column(name = "model_name", length = 100, nullable = false)
    private String modelName;

    @Comment("模型类型")
    @SearchItem(name = "modelType", key = "modelType", label = "模型类型")
    @FormField(title = "模型类型", sortNum = "2", grid = true, type = InputType.select)
    @Column(name = "model_type", length = 50)
    private String modelType; // SALES_PREDICTION-销售预测, INVENTORY_PREDICTION-库存预测, PRICE_PREDICTION-价格预测, DEMAND_PREDICTION-需求预测, QUALITY_PREDICTION-质量预测

    @Comment("算法类型")
    @SearchItem(name = "algorithmType", key = "algorithmType", label = "算法类型")
    @FormField(title = "算法类型", sortNum = "3", grid = true, type = InputType.select)
    @Column(name = "algorithm_type", length = 50)
    private String algorithmType; // LINEAR_REGRESSION-线性回归, RANDOM_FOREST-随机森林, GRADIENT_BOOSTING-梯度提升, NEURAL_NETWORK-神经网络, LSTM-长短期记忆网络

    @Comment("模型版本")
    @FormField(title = "模型版本", sortNum = "4", grid = true)
    @Column(name = "model_version", length = 20)
    private String modelVersion;

    @Comment("准确率")
    @FormField(title = "准确率", sortNum = "5", grid = true, type = InputType.el_input_number)
    @Column(name = "accuracy_rate", precision = 5, scale = 2)
    private BigDecimal accuracyRate;

    @Comment("训练数据大小")
    @FormField(title = "训练数据大小", sortNum = "6", grid = true, type = InputType.el_input_number)
    @Column(name = "training_data_size")
    private Long trainingDataSize;

    @Comment("最后训练时间")
    @FormField(title = "最后训练时间", sortNum = "7", type = InputType.date, grid = true)
    @Column(name = "last_training_time")
    private Date lastTrainingTime;

    @Comment("模型状态")
    @FormField(title = "模型状态", sortNum = "8", grid = true, type = InputType.select)
    @Column(name = "model_status", length = 20)
    private String modelStatus; // TRAINING-训练中, ACTIVE-已激活, INACTIVE-未激活, DEPRECATED-已废弃

    @Comment("模型文件路径")
    @FormField(title = "模型文件路径", sortNum = "9", grid = true)
    @Column(name = "model_file_path", length = 500)
    private String modelFilePath;

    @Comment("超参数配置")
    @FormField(title = "超参数配置", sortNum = "10", type = InputType.textarea)
    @Column(name = "hyper_parameters", columnDefinition = "TEXT")
    private String hyperParameters;

    @Comment("模型描述")
    @FormField(title = "模型描述", sortNum = "11", type = InputType.textarea)
    @Column(name = "description", length = 1000)
    private String description;
} 